long long maximumTripletValue(int* nums, int numsSize)
{
    long long num = 0;
    for (int i = 0; i < numsSize - 2; i++)
        for (int j = i + 1; j < numsSize - 1; j++)
            for (int k = j + 1; k < numsSize; k++)
            {
                long long int tmp = (long long)(nums[i] - nums[j]) * nums[k];
                if (tmp > num)
                    num = tmp;
            }
    return num > 0 ? num : 0;
}